import { Controller, Get, UseGuards } from '@nestjs/common';
import { StatsService } from './stats.service';
import { JwtAuthGuard } from '../auth/guards/jwt-auth.guard';
import { Roles, Role } from '../../common/decorators/roles.decorator';
import { RolesGuard } from '../../common/guards/roles.guard';

/**
 * 统计数据控制器
 */
@Controller('stats')
@UseGuards(JwtAuthGuard, RolesGuard)
@Roles(Role.ADMIN, Role.SUPER_ADMIN)
export class StatsController {
  constructor(private readonly statsService: StatsService) {}

  /**
   * 获取总体统计数据
   */
  @Get('overview')
  getOverview() {
    return this.statsService.getOverview();
  }

  /**
   * 获取访问趋势数据
   */
  @Get('trends')
  getTrends() {
    return this.statsService.getTrends();
  }

  /**
   * 获取热门工具排行
   */
  @Get('popular-tools')
  getPopularTools() {
    return this.statsService.getPopularTools();
  }

  /**
   * 获取最近活动
   */
  @Get('recent-activities')
  getRecentActivities() {
    return this.statsService.getRecentActivities();
  }
}



